﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CrearInformeSupervision.aspx.cs"
    Inherits="Supervision_CrearInformeSupervision" %>

<%--<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>--%>
<%@ Register Src="wucInformeSupervision.ascx" TagName="wucInformeSupervision" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <script type="text/javascript" language="javascript" src="../resources/utilidades.js"></script>
    <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Slate">
    </ext:ResourceManager>
    <ext:Store ID="StoreProgramas" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="Key">
                <Fields>
                    <ext:RecordField Name="Value">
                    </ext:RecordField>
                    <ext:RecordField Name="Key">
                    </ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="StoreEstado" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="Key">
                <Fields>
                    <ext:RecordField Name="Value">
                    </ext:RecordField>
                    <ext:RecordField Name="Key">
                    </ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="StoreEje" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="Key">
                <Fields>
                    <ext:RecordField Name="Value">
                    </ext:RecordField>
                    <ext:RecordField Name="Key">
                    </ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="StoreTipo" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="Key">
                <Fields>
                    <ext:RecordField Name="Value">
                    </ext:RecordField>
                    <ext:RecordField Name="Key">
                    </ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="StoreProyectos" runat="server"  OnRefreshData="StoreRefresh" AutoLoad="false">
        <Reader>
            <ext:JsonReader IDProperty="Id">
                <Fields>
                    <ext:RecordField Name="Id" />
                    <ext:RecordField Name="Nombre" />
                    <ext:RecordField Name="FechaInicio" />
                    <ext:RecordField Name="FechaFin" />
                    <ext:RecordField Name="Presupuesto" />
                    <ext:RecordField Name="Latitud" />
                    <ext:RecordField Name="Longitud" />
                    <ext:RecordField Name="Saldo" />
                    <ext:RecordField Name="UltimoPago" />
                    <ext:RecordField Name="Descripcion" />
                    <ext:RecordField Name="AportePlan" />
                    <ext:RecordField Name="PorcentajeAvance" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <Proxy>
            <ext:PageProxy></ext:PageProxy>
        </Proxy>
        <BaseParams>
			<ext:Parameter Name="cbxProgramas_bprm" Value="#{cbxProgramas}.getValue()"   Mode="Raw" />
			<ext:Parameter Name="cbxEje_bprm" Value="#{cbxEje}.getValue()"   Mode="Raw" />	
            <ext:Parameter Name="cbxCategorias_bprm" Value="#{cbxCategorias}.getValue()"   Mode="Raw" />
            <ext:Parameter Name="cbxEstado_bprm" Value="#{cbxEstado}.getValue()"   Mode="Raw" />	
            <ext:Parameter Name="txtNombrePrograma_bprm" Value="#{txtNombrePrograma}.getValue()"   Mode="Raw" />
        </BaseParams>
    </ext:Store>
    <ext:Viewport ID="Viewport1" runat="server">
        <Items>
            <ext:BorderLayout ID="BorderLayout1" runat="server">
                <North Collapsible="True" Split="false">
                    <ext:Panel ID="Panel1" BodyStyle="padding:10px;background-color:#E7E4DD;" runat="server"
                        AutoHeight="true">
                        <Items>
                            <ext:Panel  Layout="Column" Height="130"  ID="Panel2" runat="server" BodyStyle="background-color:Transparent;" ButtonAlign="Center">
                                <Items>
                                            <ext:Panel  ColumnWidth=".33" Layout="Form"  ID="Panel3" runat="server" Border="false" Header="false" BodyStyle="padding:10px;background-color:Transparent;">
                                                <Items>
                                                           <ext:ComboBox   AnchorHorizontal="95%"  Editable="false" FieldLabel="Eje" ID="cbxEje" StoreID="StoreEje" runat="server"
                                                                DisplayField="Value" ValueField="Key" TypeAhead="true" ForceSelection="true"
                                                                TriggerAction="All" Grow="true" GrowMax="300" EmptyText="Todos" SelectOnFocus="true"
                                                                AutoDataBind="True">
                                                                <Triggers>
                                                                <ext:FieldTrigger Icon="Clear" />
                                                            </Triggers>
                                                            <Listeners>
                                                                 <Select Handler="this.triggers[0].show();" />
                                                                  <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                                  <AfterRender Handler="this.triggers[0][ Ext.isEmpty(this.getValue()) ? 'hide' : 'show']();" />
                                                                  <TriggerClick Handler="if(index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                                            </Listeners>
                                                           </ext:ComboBox>
                                                       
                                                            <ext:ComboBox AnchorHorizontal="95%"  Editable="false" FieldLabel="Estado" ID="cbxEstado" runat="server"
                                                                StoreID="StoreEstado" DisplayField="Value" ValueField="Key" TypeAhead="true"
                                                                ForceSelection="true" TriggerAction="All" Grow="true" GrowMax="300" EmptyText="Todos"
                                                                SelectOnFocus="true" AutoDataBind="True">
                                                                 <Triggers>
                                                                <ext:FieldTrigger Icon="Clear" />
                                                            </Triggers>
                                                            <Listeners>
                                                                 <Select Handler="this.triggers[0].show();" />
                                                                  <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                                  <AfterRender Handler="this.triggers[0][ Ext.isEmpty(this.getValue()) ? 'hide' : 'show']();" />
                                                                  <TriggerClick Handler="if(index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                                            </Listeners>
                                                            </ext:ComboBox>
                                                        
                                                </Items>
                                            </ext:Panel>
                                            <ext:Panel  ColumnWidth=".34" Layout="Form"   ID="Panel4" Height="70" runat="server" Border="false" BodyStyle="padding:10px;background-color:Transparent;">
                                                <Items>
                                                    
                                                            <ext:ComboBox AnchorHorizontal="95%"  Editable="false" FieldLabel="Programa" ID="cbxProgramas" runat="server"
                                                                StoreID="StoreProgramas" DisplayField="Value" ValueField="Key" TypeAhead="true"
                                                                ForceSelection="true" TriggerAction="All" Grow="true" GrowMax="300" EmptyText="Todos"
                                                                SelectOnFocus="true" AutoDataBind="True">
                                                                 <Triggers>
                                                                <ext:FieldTrigger Icon="Clear" />
                                                            </Triggers>
                                                            <Listeners>
                                                                 <Select Handler="this.triggers[0].show();" />
                                                                  <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                                  <AfterRender Handler="this.triggers[0][ Ext.isEmpty(this.getValue()) ? 'hide' : 'show']();" />
                                                                  <TriggerClick Handler="if(index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                                            </Listeners>
                                                            </ext:ComboBox>
                                                     
                                                            <ext:TextField  AnchorHorizontal="95%" FieldLabel="Nombre" ID="txtNombrePrograma" runat="server" />
                                                  
                                                </Items>
                                            </ext:Panel>
                                       
                                            <ext:Panel   ColumnWidth=".33" Layout="Form"  ID="Panel5" Height="70" runat="server" Border="false" BodyStyle="padding:10px;background-color:Transparent;">
                                                <Items>
                                                    
                                                            <ext:ComboBox AnchorHorizontal="95%"  Editable="false" FieldLabel="Tipo" ID="cbxCategorias" StoreID="StoreTipo"
                                                                runat="server" DisplayField="Value" ValueField="Key" TypeAhead="true" ForceSelection="true"
                                                                TriggerAction="All" Grow="true" GrowMax="300" EmptyText="Todos" SelectOnFocus="true"
                                                                AutoDataBind="True">
                                                               <Triggers>
                                                                <ext:FieldTrigger Icon="Clear" />
                                                            </Triggers>
                                                            <Listeners>
                                                                 <Select Handler="this.triggers[0].show();" />
                                                                  <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                                                                  <AfterRender Handler="this.triggers[0][ Ext.isEmpty(this.getValue()) ? 'hide' : 'show']();" />
                                                                  <TriggerClick Handler="if(index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
                                                            </Listeners>
                                                            </ext:ComboBox>
                                                     
                                                </Items>
                                            </ext:Panel>
                                       
                                </Items>
                                <Buttons>
                                    <ext:Button runat="server" ID="btnBuscar" Text="Buscar" Icon="Find">
                                        <%--
                                        <DirectEvents>
                                            <Click OnEvent="btnBuscar_Click">
                                                <EventMask ShowMask="true" />
                                            </Click>
                                        </DirectEvents>
                                         --%>
                                        <Listeners>
                                          <Click Handler="#{StoreProyectos}.load();" />
                                        </Listeners>

                                    </ext:Button>
                                </Buttons>
                            </ext:Panel>
                        </Items>
                    </ext:Panel>
                </North>
                <Center Margins-Top="120">
                    <ext:GridPanel ID="GridPanelProyectos" runat="server" StoreID="StoreProyectos" StripeRows="true"
                        AutoWidth="true" Height="250px" Title="Proyectos">
                        <ColumnModel ID="ColumnModel1" runat="server">
                            <Columns>
                                  <ext:CommandColumn Header="Opciones" Width="110">
                                    <Commands>
                                        <ext:GridCommand CommandName="Ver" Text="Ver" Icon="CommentEdit" ToolTip-Text="Ver informes de supervision del proyecto">
                                        </ext:GridCommand>
                                        <ext:GridCommand CommandName="Nuevo" Text="Nuevo" Icon="CommentAdd" ToolTip-Text="Crear nuevo informe de supervision al proyecto">
                                        </ext:GridCommand>
                                    </Commands>
                                </ext:CommandColumn>
                                <ext:Column ColumnID="NombreProyecto" Header="Nombre del proyecto" Width="200" Sortable="true"
                                    DataIndex="Nombre" />
                                <ext:Column Header="Descripcion" Width="150" Sortable="true" DataIndex="Descripcion">
                                </ext:Column>
                                <ext:Column Header="Saldo por desembolsar" Width="140" Sortable="true" DataIndex="Saldo">
                                    <Renderer Format="UsMoney" />
                                </ext:Column>
                                <ext:Column Header="Ultimo Pago" Width="140" Sortable="true" DataIndex="UltimoPago">
                                    <Renderer Format="UsMoney" />
                                </ext:Column>
                                <ext:Column Header="Avance" Width="160" Sortable="true" DataIndex="PorcentajeAvance">
                                    <Renderer Handler="return record.data.PorcentajeAvance+'%';" />
                                </ext:Column>
                              
                            </Columns>
                        </ColumnModel>
                        <DirectEvents>
                            <Command OnEvent="VerInforme">
                                <ExtraParams>
                                    <ext:Parameter Name="Comando" Value="command" Mode="Raw" Encode="False" />
                                    <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                                </ExtraParams>
                            </Command>
                        </DirectEvents>
                        <SelectionModel>
                            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                            </ext:RowSelectionModel>
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="ptbPerfilProyecto" runat="server" StoreID="StoreProyectos"
                                DisplayInfo="true" DisplayMsg="Proyectos {0} - {1} of {2}" EmptyMsg="No existen Proyectos" />
                        </BottomBar>
                        <View>
                            <ext:GridView ID="GridView1" runat="server" ForceFit="true" />
                        </View>
                        <Plugins>
                            <ext:RowExpander ID="RowExpander1" runat="server" Collapsed="true">
                                <Template ID="Template1" runat="server">
                                    <Html>
                                            <p><b>Proyecto:</b> {Nombre}</p><br/> 
                                            <p><b>Descripci&oacute;n:</b> {Descripcion}</p> 
                                    </Html>
                                </Template>
                            </ext:RowExpander>
                        </Plugins>
                    </ext:GridPanel>
                </Center>
            </ext:BorderLayout>
        </Items>
    </ext:Viewport>
    <ext:Window runat="server" ID="winSupervision" Width="800" Height="440" Hidden="true"
        Modal="true" Resizable="false" Y="5" CenterOnLoad="true">
        <Items>
        </Items>
    </ext:Window>
    <uc2:wucInformeSupervision runat="server" ID="wucInformeSupervision1" />
    </form>
</body>
</html>
